package com.andyyan.elasticsearch.client.def.model;

import com.andyyan.elasticsearch.client.def.query.ESQueryRequest;

import java.util.List;
import java.util.Map;

/**
 * Created by yantingxin on 16-9-8.
 */
public interface ESClient {

    //创建对象的map
    boolean addMapping(String index, String type, String mapping);

    //删除index
    boolean delIndex(String index);

    //批量保存对象
    boolean batchAddDocument(String index, String type, Map<String, Object> objectMap);

    boolean batchDelDocument(String index, String type, List<String> idList);

    //保存单个对象
    boolean addDocument(String index, String type, String id, Object object);

    String getDocumentJson(String index, String type, String id);

    <T> T getDocument(String index, String type, String id, Class<T> clazz);

    //删除
    boolean delDocument(String index, String type, String id);

    //判断是否存在index
    boolean existIndex(String index);

    //判断是否存在type
    boolean existType(String index, String type);

    boolean existType(String[] indexs, String[] types);

    //mapping
    String getMappingsJson(String index, String type);

    //查询
    <T> List<Item<T>> query(ESQueryRequest request, Class<T> clazz);
}
